package io.mft.dev.base;

import cn.hutool.core.util.ObjectUtil;
import io.mft.commons.exception.MFTException;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class ApiThreadExecutorConfig {
	private String code="default";
	private int workQueueCapacity = 1024;
	private int maxPoolSize = 8;
	private String moduleKey;
	private String systemKey;
	
	public String threadExecutorId() {
		if (ObjectUtil.isEmpty(systemKey)) {
			throw new MFTException("ApiThreadExecutor系统KEY不允许空,请检查");
		}
		if (ObjectUtil.isEmpty(moduleKey)) {
			throw new MFTException("ApiThreadExecutor模块KEY不允许空,请检查");
		}
		String threadExecutorKey=systemKey+"."+moduleKey;
		if (ObjectUtil.isNotEmpty(code)) {
			threadExecutorKey=threadExecutorKey+"."+code; 
		}
		return threadExecutorKey;
	}
}
